﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Reflection;

namespace EntLib.Domain.Model
{
    public class Base : ISetProperty
    {
        /// <summary>
        /// 设置公告属性值
        /// </summary>
        /// <param name="idr">数据接口</param>
        public void SetProperty(IDataReader idr)
        {
            PropertyInfo[] propertyInfos = this.GetType().GetProperties();
            foreach (PropertyInfo item in propertyInfos)
            {
                if (idr[item.Name] != DBNull.Value)
                {
                    item.SetValue(this, idr[item.Name], null);
                }
            }
        }
    }
}
